package com.meida.module.bus.client.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 订单类型
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum OrderTypeEnum {
    OrderType10(10, "消费"),
    OrderType20(20, "返佣"),
    OrderType21(21, "返佣提现"),
    OrderType30(30, "分红"),
    OrderType31(31, "分红提现"),
    OrderType40(40, "加权分红"),
    OrderType41(41, "加权分红提现"),
    OrderType50(50, "退回");

    OrderTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @EnumValue
    private final Integer code;
    private final String desc;

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static OrderTypeEnum getByValue(Integer code) {
        for (OrderTypeEnum orderTypeEnum : values()) {
            if (code.equals(orderTypeEnum.getCode())) {
                return orderTypeEnum;
            }
        }
        return null;
    }
}
